package com.panda.mall.common.mallWares.enums;

import com.panda.mall.common.base.EnumInterface;
import lombok.Getter;

/**
 * author: tcy
 * description:商品级别枚举
 */
public enum LevelEnum implements EnumInterface {

    ONE("one",1,"一级"),
    TWO("two",2,"二级"),
    THERE("there",3,"三级");

    /**
     * 编码
     */
    @Getter
    protected String code;

    /**
     * 值
     */
    @Getter
    protected Integer value;


    /**
     * 键
     */
    @Getter
    protected String key;

    LevelEnum(String code, int value, String key) {
        this.code = code;
        this.value = value;
        this.key = key;
    }

    public static LevelEnum getByValue(Integer value) {

        LevelEnum baseEnum = null;

        for (LevelEnum item : values()) {
            if (item.getValue().equals(value)) {
                baseEnum = item;
                continue;
            }
        }
        return baseEnum;
    }

}
